// JavaScript Document
function onSubmitForm(formName,url)
{ 
	var theForm = document.getElementById(formName);
	theForm.action = url;	
	theForm.submit();	
	return true;
  
}

function popUp(link,frameWidth){
	//$.colorbox({href:link,inline:true, height:"500px",width:frameWidth});
	var str;
	$.colorbox({href:link,iframe:true, height:"500px",innerWidth:frameWidth});
	str = 'width: ' + frameWidth + '; overflow-x: hidden; overflow-y: auto; height: 500px;'
	$('#cboxLoadedContent').attr('style',str);
	
}

function submitParent(link,formID){
	$("#" + formID ,parent.document).attr("action", link);
	$("#" + formID ,parent.document).submit();
}

function clearData(name){
	var newName = name + '-name';
	var newID = name + '-id';
	$('#' + newName).attr('value','');
	$('#' + newID).attr('value',0);
}
function loadPage(area, url){
	$(area).load(url);
}

function goPage(){
	alert(this.value);
}

function submitQuestion(formName,url,question)
{ 
	
	var answer = confirm (question);
	if (answer){
		var theForm = document.getElementById(formName);
		theForm.action = url;	
		theForm.submit();	
		return true;
	}
  
}

function changeLang(url, type,lang,link)
{ 
	var goUrl = url + '/type/' + type + '/lang/' + lang+ '/link/' + link;
	window.location = goUrl;
}

var checked=false;
var checkValue;
function checkedAll(formName, checkboxName) {
    var theForm = document.getElementById(formName);;
    if (checked == false)
    {
    	checked = true;
    	checkValue = theForm.elements.length;
    }
    else
    {
    	checked = false;
    	checkValue = 0;
    }
    
    var countCheckBox = 0;
    for (i=0; i<theForm.elements.length; i++) {
        if (theForm.elements[i].name=='cid[]'){
            theForm.elements[i].checked = checked;
            countCheckBox++;
        }
    }
    
    if (checked == true)
    {
    	checkValue = countCheckBox;
    }
    else
    {    	
    	checkValue = 0;
    }
}

